package impl_v1.factory;

import impl_v1.AuctionInformationImpl;
import impl_v1.AuctionPrivateImpl;
import impl_v1.AuctionPublicImpl;
import impl_v1.AuctioningSystemImpl;
import impl_v1.BidImpl;
import impl_v1.ItemImpl;
import impl_v1.WinnerInformationImpl;

import java.rmi.RemoteException;

import model.AuctionInformation;
import model.AuctionPrivate;
import model.AuctionPublic;
import model.Bid;
import model.Item;
import model.WinnerInformation;
import model.factory.Factory;
import model.server.AuctioningSystem;

public class FactoryImpl implements Factory {

	private final AuctioningSystem auctioningSystemInstance;

	public FactoryImpl() throws RemoteException {
		super();
		this.auctioningSystemInstance = new AuctioningSystemImpl(this);
	}
	
	@Override
	public AuctioningSystem getAuctioningSystem() {
		return auctioningSystemInstance;
	}

	@Override
	public AuctionPrivate newAuctionPrivate(int reservePrice, int key, int startingPrice, Item item) {
		return new AuctionPrivateImpl(reservePrice, key, startingPrice, item);
	}

	@Override
	public AuctionPublic newAuctionPublic(int startingPrice, Item item) {
		return new AuctionPublicImpl(startingPrice, item);
	}

	@Override
	public Bid newBid(int price, String name, String email) {
		return new BidImpl(price, name, email);
	}

	@Override
	public Item newItem(String title, String description) {
		return new ItemImpl(title, description);
	}

	@Override
	public AuctionInformation newAuctionInformation(int auctionID, int key) {
		return new AuctionInformationImpl(auctionID, key);
	}

	@Override
	public WinnerInformation newBuyerInformation(String name, String email, int finishingPrice) {
		return new WinnerInformationImpl(name, email, finishingPrice);
	}

	@Override
	public AuctionPublic newAuctionPublic(AuctionPrivate auction) {
		return new AuctionPublicImpl(auction);
	}

}
